package DengLu;

import GongNeng.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class Admin extends JFrame {

    public static void main(String args[]){
        Admin frame = new Admin();
        frame.setVisible(true);
    }
    public Admin(){
        super();
        setTitle("图书管理信息系统");
        setBounds(350,100,1200,800);
        getContentPane().setLayout(null);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);


        JPanel panel =new JPanel();
        panel.setBounds(0,0,1200,800);
        panel.setLayout(null);
        getContentPane().add(panel);



        final JLabel label = new JLabel();
        label.setText("长江大学文理学院图书管理信息系统");
        label.setBounds(380 ,150,450,50);
        label.setFont(new Font("",Font.BOLD,22));
        label.setHorizontalAlignment(JLabel.CENTER);
        panel.add(label);

        final JButton button = new JButton();
        button.setText("图书录入");
        button.setBounds(380,300,100,50);
        button.setMargin(new Insets(0,0,0,0));
        button.setContentAreaFilled(false);
        button.addActionListener(new ButtonAction());
        panel.add(button);

        final JButton button1 = new JButton();
        button1.setText("图书查询");
        button1.setBounds(500,300,100,50);
        button1.setMargin(new Insets(0,0,0,0));
        button1.setContentAreaFilled(false);
        button1.addActionListener(new ButtonAction());
        panel.add(button1);

        final JButton button2 = new JButton();
        button2.setText("图书借阅");
        button2.setBounds(620,300,100,50);
        button2.setMargin(new Insets(0,0,0,0));
        button2.setContentAreaFilled(false);
        button2.addActionListener(new ButtonAction());
        panel.add(button2);

        final JButton button3 = new JButton();
        button3.setText("图书归还");
        button3.setBounds(740,300,100,50);
        button3.setMargin(new Insets(0,0,0,0));
        button3.setContentAreaFilled(false);
        button3.addActionListener(new ButtonAction());
        panel.add(button3);





    }
    class ButtonAction implements ActionListener{

        public void actionPerformed(ActionEvent e) {
            JButton button =(JButton)e.getSource();
            String buttonName = e.getActionCommand();
            if (buttonName.equals("图书录入")){
                new Enter().setVisible(true);
                dispose();
            }else if (buttonName.equals("图书查询")){
                new Search().setVisible(true);
                dispose();
            }else if (buttonName.equals("图书借阅")){
                new Borrow().setVisible(true);
                dispose();
            }else{
                new Return().setVisible(true);
                dispose();
            }
        }


    }
}
